package nahuel.games.carracer;

import android.graphics.Bitmap;

public class Diagonal extends Calle {

	private int pendiente;
	private int anchoCalle;
	
	public Diagonal(Bitmap imagen, int xPosCalle, int xPosCalleFin, int anchoCalle, int pendiente){
		super(imagen, xPosCalle, xPosCalleFin);
		this.pendiente = pendiente;
		this.anchoCalle = anchoCalle;
	}
	
	@Override
	public boolean enRuta(int posX, int posY) {
		return (pendiente * posX > posY && posY < pendiente * (posX + anchoCalle) );
	}

}
